package com.training.food.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.training.food.Mapper.RecordinfoMapper;
import com.training.food.Mapper.UserMapper;
import com.training.food.pojo.Examine;
import com.training.food.pojo.Recordinfo;
import com.training.food.pojo.Slaughter;
import com.training.food.pojo.User;
import com.training.food.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecordServiceImpl extends ServiceImpl<RecordinfoMapper, Recordinfo> implements RecordService {
    @Autowired
    RecordinfoMapper recordinfoMapper;
    @Autowired
    UserMapper userMapper;
    @Override
    public boolean hasRecord(Recordinfo recordinfo) {
        Recordinfo recordinfo1=recordinfoMapper.find(recordinfo.getUsername());
        if(recordinfo1==null)return false;
        return true;
    }

    @Override
    public void record(Recordinfo recordinfo) {
        recordinfoMapper.insert(recordinfo);
    }

    @Override
    public List<Recordinfo> lists(List<Slaughter> Slaughters) {
        return recordinfoMapper.lists(Slaughters);
    }

    @Override
    public void updateRecode(Recordinfo recordinfo) {
        recordinfoMapper.update(recordinfo);
    }

    @Override
    public Recordinfo select(String username) {
        return recordinfoMapper.select(username);
    }

    @Override
    public List<User> selectUsers() {
        return userMapper.getUsers();
    }

    @Override
    public List<Recordinfo> selectRecords() {
        return recordinfoMapper.selectRecords();
    }

    @Override
    public List<Recordinfo> records(List<Examine>examines) {
        return recordinfoMapper.records(examines);
    }

}
